// PropertyExpression.cpp: implementation of the PropertyExpression class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "PropertyExpression.h"
#include "SyntaxAnalyzer.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
namespace pa
{
	PropertyExpression::PropertyExpression(const StdString& strExpression,
											PropertyContainer* pContainer)
	{
		ASSERT(!strExpression.IsEmpty());
		m_strExpression = strExpression;
		m_pContainer = pContainer;
	}
	
	Variable PropertyExpression::Caculate()
	{
		SyntaxAnalyzer SAnalyzer(m_strExpression, m_pContainer);
		if(!SAnalyzer.Interpret())
		{
			SAnalyzer.ReportError();
			return Variable();
		}

		return SAnalyzer.Execute();
	}

	PropertyExpression::~PropertyExpression()
	{	
	}

};